/**
 * Copyright (C) 2008 aileron.cc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cc.aileron.web.cm.context;

import javax.servlet.FilterConfig;

import com.google.inject.Inject;

import cc.aileron.web.cm.ApplicationContext;
import cc.aileron.web.cm.condition.MessageCondition;

/**
 * ApplicationContext 実態
 * @author Aileron
 *
 */
public class ApplicationContextImpl implements ApplicationContext
{
    @Inject
    public ApplicationContextImpl(final FilterConfig config)
    {
        this.contextPath = config.getServletContext().getContextPath();
        this.resourcePath = contextPath + "/Resources/";
    }
    
    /**
     * path
     */
    private final String contextPath;
    
    /**
     * リソースパス
     */
    private final String resourcePath;

    /* (非 Javadoc)
     * @see cc.aileron.web.cm.ApplicationContext#getContextPath()
     */
    @Override
    public String getContextPath()
    {
        return contextPath;
    }

    /* (非 Javadoc)
     * @see cc.aileron.web.cm.ApplicationContext#getResourcePath()
     */
    @Override
    public String getResourcePath()
    {
        return resourcePath;
    }

    @Override
    public MessageCondition getDefaultCondition()
    {
        final MessageCondition condition = new MessageCondition();
        condition.offset= 0;
        condition.limit = 10;
        return condition;
    }
}